/*
 * @Author: TC
 * @Date: 2025-04-20 11:57:50
 * @Last Modified by: TC
 * @Last Modified time: 2025-04-20 12:05:37
 */

/**
 * 任务工具类
 */
export namespace nsTaskUtil {
    /**
     * 执行任务列表
     * @param tasks
     * @param onComplete
     */
    export function executeTaskList(tasks: ((cb: Function) => void)[], onComplete?: Function): void {
        const len = tasks.length;
        let completeNum = 0;
        const func = function () {
            completeNum += 1;
            if (completeNum >= len) {
                onComplete && onComplete();
            }
        };
        for (let i = 0; i < len; ++i) {
            tasks[i](func);
        }
    }
}
